import { NativeHelper } from "../../native/NativeHelper";
import { EmptyAnalyticsSender } from "../IAnalyticsAble";

/**
 * 原生平台事件上报器
 */
export class NativeAnalyticsSender extends EmptyAnalyticsSender{
    protected _className:string = "sdk.Share";
    
    constructor(className:string="sdk.Share", reportError?:boolean, exclude?:string[]) {
        super(reportError, exclude);
        this._className = className;
    }
    
    send(eventName: string, data:object): Promise<void> {
        return new Promise((success)=>{
            NativeHelper.call(this._className, "report", eventName, JSON.stringify(data));
            success();
        })
    }
}
